﻿<%@ Page Title="SearchCar" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SearchCar.aspx.cs" Inherits="CarRental.View.SearchCar" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <form runat="server" id="SearchCar">
        <fieldset>
            <legend>Search Car</legend>
            <table id="t_searchcar" runat="server">
                <tr>
                    <td>
                        <asp:Label ID="lb_Color" runat="server" AssociatedControlID="ddlColor">Color</asp:Label>
                        <asp:DropDownList ID="ddlColor" runat="server" Width="200px" Height="25px"></asp:DropDownList>
                    </td>
                    <td>
                        <asp:Label ID="lb_type" runat="server" AssociatedControlID="ddlCarType">Car Type</asp:Label>
                        <asp:DropDownList ID="ddlCarType" runat="server" Width="200px" Height="25px"></asp:DropDownList>
                    </td>
                    <td>
                        <asp:Label ID="lb_depot" runat="server" AssociatedControlID="ddlDepot">Depot</asp:Label>
                        <asp:DropDownList ID="ddlDepot" runat="server" Width="200px" Height="25px"></asp:DropDownList>
                    </td>
                    <td>
                        <asp:Label ID="lb_drivetrains" runat="server" AssociatedControlID="ddlDrivetrains">Drivetrains</asp:Label>
                        <asp:DropDownList ID="ddlDrivetrains" runat="server" Width="200px" Height="25px"></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="lblCarNo" runat="server" AssociatedControlID="tbCarNo">Car No</asp:Label>
                        <asp:TextBox ID="tbCarNo" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button runat="server" ID="btnSearchCar" Text="Search Car" OnClick="btnSearchCar_Click" Width="116px" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <asp:GridView ID="gvCarLst" runat="server" DataSourceID="EntityDataSource_SearchCar" AutoGenerateColumns="False" DataKeyNames="id,car_no,car_model,car_typecode,depot,drivetrains,color,status,buy_in_date,buy_in_cost,rent_price,last_rental_date,last_rental_order_no,number_of_rental,shopcode,shopname,car_type,depot_name,drivetrains_name" OnRowCommand="gvCarLst_RowCommand">
                            <Columns>
                                <asp:ButtonField ButtonType="Image" CommandName="Edit" Text="Edit" ImageUrl="~/images/Edit.jpg" />
                                <asp:BoundField DataField="car_no" HeaderText="car_no" ReadOnly="True" SortExpression="car_no"></asp:BoundField>
                                <asp:BoundField DataField="car_model" HeaderText="car_model" ReadOnly="True" SortExpression="car_model" />
                                <asp:BoundField DataField="car_type" HeaderText="car_type" ReadOnly="True" SortExpression="car_type" />
                                <asp:BoundField DataField="depot_name" HeaderText="depot_name" ReadOnly="True" SortExpression="depot_name" />
                                <asp:BoundField DataField="drivetrains_name" HeaderText="drivetrains_name" ReadOnly="True" SortExpression="drivetrains_name" />
                                <asp:BoundField DataField="color" HeaderText="color" ReadOnly="True" SortExpression="color" />
                                <asp:BoundField DataField="rent_price" HeaderText="rent_price" ReadOnly="True" SortExpression="rent_price" />
                            </Columns>
                        </asp:GridView>

                        

                        <asp:EntityDataSource ID="EntityDataSource_SearchCar" runat="server" ConnectionString="name=car_rental_dbEntities" DefaultContainerName="car_rental_dbEntities" EnableFlattening="False" EntitySetName="vwcar" EntityTypeFilter="vwcar" Where="" AutoGenerateWhereClause="True">
                            <WhereParameters>
                                <asp:ControlParameter ControlID="ddlColor" Name="color" PropertyName="SelectedValue" />
                                <asp:ControlParameter ControlID="ddlDepot" Name="depot" PropertyName="SelectedValue" />
                                <asp:ControlParameter ControlID="ddlDrivetrains" Name="drivetrains" PropertyName="SelectedValue" />
                                <asp:ControlParameter ControlID="ddlCarType" Name="car_typecode" PropertyName="SelectedValue" />
                                <asp:ControlParameter ControlID="tbCarNo" Name="car_no" PropertyName="Text" />
                            </WhereParameters>
                        </asp:EntityDataSource>

                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="right">
                        <%--<asp:Button ID="btn_AddCart" runat="server" OnClick="btn_AddCart_Click" Text="Continue To Book" />--%>
                    </td>
                </tr>
            </table>
        </fieldset>
    </form>
</asp:Content>
